package dl.domainmodel.model;

import dl.martinfowler.wrapper.MfDate;
import dl.martinfowler.wrapper.Money;

public class RevenueRecognition {
	
	private Money amount;
	private MfDate recognizedOn;
	
	public RevenueRecognition(Money amount, MfDate recognizedOn){
		this.amount = amount;
		this.recognizedOn = recognizedOn;
	}
	
	public Money getAmount(){
		return amount;
	}
	
	boolean isRecognizableBy(MfDate asOf){
		return asOf.after(recognizedOn) || asOf.equals(recognizedOn);
	}
	
	@Override
	public String toString() {
		return this.amount.amount() + " : " + this.recognizedOn.toSqlDate();
	}

}
